home *** CD-ROM | disk | FTP | other *** search
/ PC Open 100 / PC Open 100 CD 1.bin / CD1 / INTERNET / WEBDESIGN / Tsw WebCoder / tswwebcoder5en.exe / {app} / data / tools / dialog_img.xml < prev    next >
Encoding:
Extensible Markup Language  |  2004-05-23  |  9.0 KB  |  146 lines

  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <dialog width="500" height="390" caption="Image">
  3.     <controls>
  4.         <panel name="mainpanel" caption="" width="417" height="142" align="alclient" bevelinner="bvnone" bevelouter="bvnone">
  5.             <label name="lblHeight" caption="Height" hint="" width="33" height="13" top="88" left="8"/>
  6.             <label name="lblWidth" caption="Width" hint="" width="41" height="13" top="88" left="100"/>
  7.             <label name="lblAltDescription" caption="ALT text" hint="Write an alternative text, which will be displayed in browsers that doesn't support images and when the mouse hovers over the image." width="53" height="13" top="48" left="8"/>
  8.             <label name="lblImageUrl" caption="Image" hint="Path for the image that you wish to insert." width="38" height="13" top="8" left="8"/>
  9.             <label name="lblBorder" caption="Border" hint="" width="44" height="13" top="88" left="192"/>
  10.             <label name="lblVSpace" caption="Top/bottom margin" hint="Enter the distance between the top and bottom side of the image, and the surrounding elements." width="98" height="13" top="136" left="8"/>
  11.             <label name="lblHSpace" caption="Right/left margin" hint="Enter the distance between the left and right side of the image, and the surrounding elements." width="123" height="13" top="136" left="142"/>
  12.             <speedbutton name="btnShowImageExplorer" glyph="icons\16x16\search.bmp" caption="" hint="Look for an image using WebCoders Image Explorer." width="19" height="19" top="24" left="202">
  13.                 <event type="onclick">
  14.                     FileName := ShowImageExplorer;
  15.                     If FileName <> '' then
  16.                      ShowImage(FileName);
  17.                 </event>
  18.             </speedbutton>
  19.             <speedbutton name="btnReCalculate" glyph="icons\16x16\calculator.bmp" caption="" hint="Set hight and width from the current image." width="19" height="19" top="24" left="224">
  20.                 <event type="onclick">
  21.                       speWidth.Value := imgPreview.Picture.Width;
  22.                     speHeight.Value := imgPreview.Picture.Height;
  23.                 </event>
  24.             </speedbutton>
  25.             <speedbutton name="btnSearchForImage" glyph="icons\16x16\look_for_files.bmp" caption="" hint="Look on the computer for an image file." width="19" height="19" top="24" left="246">
  26.                 <event type="onclick">
  27.                     Dlg := TOpenPictureDialog.Create(nil);    
  28.                     ImageExtensions := GetImageTypes();
  29.                     Dlg.Filter := 'Image files ('+ImageExtensions+')|'+ImageExtensions;                                        
  30.                       If Dlg.Execute then
  31.                      ShowImage(Dlg.FileName);
  32.                     Dlg.Free;    
  33.                 </event>
  34.             </speedbutton>
  35.             <edit name="edtALTDescription" taborder="2" text="" hint="Write an alternative text, which will be displayed in browsers that doesn't support images and when the mouse hovers over the image." width="257" height="19" top="64" left="8"/>
  36.             <edit name="edtImageUrl" taborder="0" text="" hint="Path for the image that you wish to insert." width="193" height="19" top="24" left="8"/>
  37.             <spinedit name="speWidth" taborder="4" hint="Width of the image. If you change it to another value than the images actual width, it will look stretched or truncated." maxvalue="10000" minvalue="0" width="70" height="20" top="104" left="100"/>
  38.             <spinedit name="speHeight" taborder="3" hint="Width of the image. If you change it to another value than the images actual width, it will look stretched or truncated." maxvalue="1000" minvalue="0" width="70" height="20" top="104" left="8"/>
  39.             <checkbox name="cbStretchPreview" caption="Stretch image" taborder="8" hint="Stretch the image to fill out the entire preview area. This will have no effect on the image when it's shown on your page." checked="0" width="121" height="17" top="8" left="280">
  40.                 <event type="onclick">imgPreview.Stretch := cbStretchPreview.Checked;</event>
  41.             </checkbox>
  42.             <spinedit name="speBorder" taborder="5" hint="If the border value is above 0, a border will displayed around your image." maxvalue="0" minvalue="0" width="70" height="20" top="104" left="192"/>
  43.             <spinedit name="speHSpace" taborder="7" hint="Enter the distance between the left and right side of the image, and the surrounding elements." maxvalue="0" minvalue="0" width="120" height="20" top="152" left="142"/>
  44.             <spinedit name="speVSpace" taborder="6" hint="Enter the distance between the top and bottom side of the image, and the surrounding elements." maxvalue="0" minvalue="0" width="120" height="20" top="152" left="8"/>
  45.             <shape name="shpImageBorder" width="182" height="182" top="24" left="280"/>
  46.             <image name="imgPreview" width="180" height="180" top="25" left="281"/>
  47.         </panel>
  48.     </controls>
  49.     <dialogfunctions>
  50.         procedure ShowImage(Path: string);
  51.          begin
  52.             edtImageUrl.Text := GetRelativePath('', Path);
  53.             imgPreview.LoadFromFile(Path);
  54.             speWidth.Value := imgPreview.Picture.Width;
  55.             speHeight.Value := imgPreview.Picture.Height;        
  56.          end;
  57.     </dialogfunctions>
  58.     <dialogevents>
  59.         <event type="onclose" resulttype="ok">
  60.                StartCode := '<img src="' + edtImageUrl.Text+'" height="'+IntToStr(speHeight.Value)+'" width="'+IntToStr(speWidth.Value)+'"';
  61.             StartCode := StartCode + (' border="'+(IntToStr(speBorder.Value))+'"');               
  62.             If edtAltDescription.Text > '' then
  63.              StartCode := StartCode + (' alt="'+(edtAltDescription.Text)+'"');        
  64.             If speVSpace.Value > 0 then
  65.              StartCode := StartCode + (' vspace="'+(IntToStr(speVSpace.Value))+'"');
  66.             If speHSpace.Value > 0 then
  67.                 StartCode := StartCode + (' hspace="'+(IntToStr(speHSpace.Value))+'"');
  68.  
  69.  
  70.               If edtCSSClass.Text <> '' then
  71.              StartCode := StartCode + ' class="'+edtCSSClass.Text+'"';
  72.               If edtCSSId.Text <> '' then
  73.                StartCode := StartCode + ' ID="'+edtCSSId.Text+'"';
  74.               If edtCSSStyle.Text <> '' then
  75.                StartCode := StartCode + ' style="'+edtCSSStyle.Text+'"';
  76.                
  77.             for i := 0 to EventGrid.Count - 1 do
  78.               begin
  79.               if EventGrid.Rows[i].EditText <> '' then
  80.                StartCode := StartCode + ' ' + (EventGrid.Rows[i].Caption+'="' + EventGrid.Rows[i].EditText)+'"';
  81.              end;  
  82.             StartCode := StartCode + '>';
  83.             EndCode := '';
  84.             If cbMakeXHTMLCompliant.Checked then
  85.              StartCode := MakeXHTMLCompliant(StartCode, false);
  86.             If cbDoPHPEscape.Checked then
  87.              StartCode := DoPHPEscape(StartCode);
  88.              
  89.             // A little "hack" - WebCoder will set this, to let us know whether to update
  90.             // an existing tag, or insert a brand new one
  91.             If cbUpdateExistingTag.Checked then 
  92.              ReplaceTag(StartCode+EndCode)
  93.             else 
  94.                InsertTags(StartCode, EndCode);                
  95.         </event>
  96.         <event type="onshow">    
  97.             // Lets put the advanced panel in the right place
  98.             pnlAdvanced.Parent := MainPanel;
  99.             pnlAdvanced.Left := 8;
  100.             pnlAdvanced.Top := MainPanel.Height - 32;        
  101.             pnlAdvanced.Width := Self.Width - 36;
  102.             // Height of the panel will be set internally. Do we need to make the dialog higher to make room for the Advanced panel?
  103.             If pnlAdvanced.Height > 20 then
  104.              Self.Height := Self.Height + 200;
  105.         </event>
  106.         <event type="updatedialog">
  107.             // This event will be called when a user executes the "Edit current tag"-rightclick feature
  108.             // The entire selected tag will be passed as a parameter to this function, that should update
  109.             // the required fields of the dialog.
  110.             function UpdateDialog(Tag: string);
  111.              begin
  112.               edtImageUrl.Text := GetValueFromAttribute(Tag, 'src');
  113.               If GetValueFromAttribute(Tag, 'height') <> '' then
  114.                  speHeight.Value := StrToInt(GetValueFromAttribute(Tag, 'height'));
  115.                If GetValueFromAttribute(Tag, 'width') <> '' then                 
  116.                speWidth.Value := StrToInt(GetValueFromAttribute(Tag, 'width'));
  117.               If GetValueFromAttribute(Tag, 'border') <> '' then               
  118.                speBorder.Value := StrToInt(GetValueFromAttribute(Tag, 'border'));
  119.               If GetValueFromAttribute(Tag, 'vspace') <> '' then
  120.                speVSpace.Value := StrToInt(GetValueFromAttribute(Tag, 'vspace'));
  121.               If GetValueFromAttribute(Tag, 'hspace') <> '' then
  122.                 speHSpace.Value := StrToInt(GetValueFromAttribute(Tag, 'hspace'));          
  123.               edtAltDescription.Text := GetValueFromAttribute(Tag, 'alt');
  124.  
  125.                 edtCSSClass.Text := GetValueFromAttribute(Tag, 'class');
  126.                 edtCSSId.Text := GetValueFromAttribute(Tag, 'id');
  127.                 edtCSSStyle.Text := GetValueFromAttribute(Tag, 'style');
  128.               for i := 0 to EventGrid.Count - 1 do
  129.                 begin
  130.                  EventVal := GetValueFromAttribute(Tag, Lowercase(EventGrid.Rows[i].Caption));
  131.                  If EventVal <> '' then
  132.                   EventGrid.Rows[i].EditText := EventVal;
  133.                end;          
  134.               cbDoPHPEscape.Checked := IsPHPEscaped(Tag);
  135.               cbMakeXHTMLCompliant.Checked := isXHTMLDocument();                    
  136.               if((edtImageUrl.Text <> '') and (FileExists(ExtractFilePath(ActiveDoc.FileName)+ExtractRelativePath(ActiveDoc.FileName, edtImageUrl.Text)))) then
  137.                begin
  138.                 imgPreview.LoadFromFile(ExtractFilePath(ActiveDoc.FileName)+ExtractRelativePath(ActiveDoc.FileName, edtImageUrl.Text));
  139.                 speWidth.Value := imgPreview.Picture.Width;
  140.                 speHeight.Value := imgPreview.Picture.Height;
  141.                end;              
  142.              end;
  143.         </event>
  144.     </dialogevents>
  145. </dialog>
  146.